﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rocket.Bll.Models;
using Rocket.Windows.Framework;
using Rocket.Data;
using AutoMapper;
using Rocket.Core;

namespace Rocket.Bll
{
    public partial class HandlerReaderApplicationQuestion: BaseHandler<ReaderApplicationQuestionView
        , ReaderApplicationQuestion>
    {
        private string _appCode = "000";
        public HandlerReaderApplicationQuestion(string appCode)
            : base(RocketRepository<ReaderApplicationQuestion>.Instance)
        {
            _appCode = appCode;
           // new HandlerQuestion();
        }

        public override List<ReaderApplicationQuestionView> GetAll()
        {
            IList<ReaderApplicationQuestion> recordList = Repository.GetAll(x => x.ReaderApplication.Code == _appCode);
            return Mapper.Map<IList<ReaderApplicationQuestion>, List<ReaderApplicationQuestionView>>(recordList);
        }

        //public partial void ForwardMap(AutoMapper.IMappingExpression<ReaderApplicationQuestionView
        //    , ReaderApplicationQuestion> mappingExpression)
        //{
        //    mappingExpression
        //        .ForMember(dest => dest.AdditionalData, opt => opt.MapFrom(src => (src.Data != null) ? src.Data.ToString() : ""));
        //}

        //public override void BackwardMap(AutoMapper.IMappingExpression<ReaderApplicationQuestion
        //    , ReaderApplicationQuestionView> mappingExpression)
        //{
        //    mappingExpression
        //        .ForMember(dest => dest, opt => opt.MapFrom(src => src.Question.Text));
        //}
    }
}
